<?php

/**
 * Our JSON_RPC_Response object
 *
 */
class JSON_RPC_Response
{
	/**
	 * Result Object
	 *
	 * @var JSON_RPC_Result
	 */
	public $result;
	/**
	 * Error Object
	 *
	 * @var JSON_RPC_Error
	 */
	public $error;
	/**
	 * ID string for serialization
	 *
	 * @var string
	 */
	public $id;
	
	/**
	 * Default constructor
	 *
	 * @param JSON_RPC_Result $result
	 * @param JSON_RPC_Error $error
	 * @param string $id
	 */
	public function __construct(JSON_RPC_Result $result = null, JSON_RPC_Error $error = null, $id = null)
	{
		$this->result = $result;
		$this->error = $error;
		$this->id = $id;
	}
}

/**
 * JSON-RPC Result Object
 *
 */
class JSON_RPC_Result
{
	/**
	 * Values from the result
	 *
	 * @var JSON_RPC_DataPair[]
	 */
	public $valueArray;
	/**
	 * String that is executed upon reception of the call
	 *
	 * @var string
	 */
	public $callbackFunctionString;
	
	/**
	 * Default Constructor
	 *
	 * @param JSON_RPC_DataPair[] $valueArray
	 * @param string $callbackFunctionString
	 */
	public function __construct($valueArray = array(), $callbackFunctionString = "")
	{
		$this->valueArray = $valueArray;
		$this->callbackFunctionString = $callbackFunctionString;
	}
}

/**
 * DataPair for JSON-RPC
 *
 */
class JSON_RPC_DataPair
{
	/**
	 * Name of the variable
	 *
	 * @var string
	 */
	public $name;
	/**
	 * Actual values
	 *
	 * @var mixed
	 */
	public $value;
	
	/**
	 * Enter description here...
	 *
	 * @param string $name
	 * @param mixed $value
	 */
	public function __construct($name = "", $value = null)
	{
		$this->name = $name;
		$this->value = $value;
	}
}

/**
 * JSON-RPC Error container object
 *
 */
class JSON_RPC_Error
{
	/**
	 * Array of error messages
	 *
	 * @var string[]
	 */
	public $errors;
	/**
	 * String that is executed upon reception of the call
	 *
	 * @var string
	 */
	public $callbackFunctionString;
	
	/**
	 * Default Constructor
	 *
	 * @param string[] $errors
	 * @param string $callbackFunctionString
	 */
	public function __construct($errors = array(), $callbackFunctionString = "")
	{
		$this->errors = $errors;
		$this->callbackFunctionString = $callbackFunctionString;
	}
}

?>